class Job {
    constructor({
      id,
      name,
      type,
      count,
      company_id:companyId,
      salary,
      status,
      introduction,
      created_date: createdDate,
      updated_date: updatedDate,
    }) {
      this.job = {
        id: String,
        name: String,
        type: String,
        count: Number,
        company_id:String,
        salary:String,
        introduction:String,
        status: Number,
        created_date: Number,
        updated_date: Number,
      }
      this.job.id = id
      this.job.name = name
      this.job.type = type
      this.job.count = count
      this.job.company_id = companyId
      this.job.introduction = introduction
      this.job.salary = salary
      this.job.status = status
      this.job.created_date = createdDate
      this.job.updated_date = updatedDate
    }
  
    getData() {
      const { job } = this
      const jobWithNoNull = { ...this.job }
  
      const properties = Object.getOwnPropertyNames(this.job)
  
      properties.forEach((property) => {
        if (Reflect.get(this.job, property) == null) {
          Reflect.deleteProperty(jobWithNoNull, property)
        }
      })
  
      return { job, jobWithNoNull }
    }
  
    get id() {
      return this.job.id === undefined ? null : this.job.id
    }
  
    set id(value) {
      this.job.id = value
    }

    get name() {
      return this.job.name === undefined ? null : this.job.name
    }
  
    set name(value) {
      this.job.name = value
    }

    get type() {
        return this.job.type === undefined ? null : this.job.type
      }
    
    set type(value) {
        this.job.type = value
    }

    get count() {
        return this.job.count === undefined ? null : this.job.count
      }
    
    set count(value) {
        this.job.count = value
    }

    get companyId() {
        return this.job.company_id === undefined ? null : this.job.company_id
      }
    
    set companyId(value) {
        this.job.company_id = value
    }
    get introduction() {
      return this.job.introduction === undefined ? null : this.job.introduction
    }
  
    set introduction(value) {
      this.job.introduction = value
    }
    get salary() {
        return this.job.salary === undefined ? null : this.job.salary
      }
    
    set salary(value) {
        this.job.salary = value
    }

    get status() {
        return this.job.status === undefined ? null : this.job.status
      }
    
    set status(value) {
        this.job.status = value
    }

    get createdDate() {
      return this.job.created_date === undefined
        ? null
        : this.job.created_date
    }
  
    set createdDate(value) {
      this.job.created_date = value
    }
  
    get updatedDate() {
      return this.job.updated_date === undefined
        ? null
        : this.job.updated_date
    }
  
    set updatedDate(value) {
      this.job.updated_date = value
    }
  }
  
  module.exports = Job
  